package cn.com.unionlife.hy.system.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import cn.com.unionlife.hy.core.exception.BusinessException;
import cn.com.unionlife.hy.system.mapper.UserMapper;
import cn.com.unionlife.hy.system.service.UserQryService;
import cn.com.unionlife.hy.system.vo.UserVO;

@Service("userQryService")
public class UserQryServiceImpl implements UserQryService {
	
	@Resource(name = "userMapper")
	private UserMapper userMapper;

	@Override
	public UserVO getUserByUsername(String username) throws BusinessException {
		return userMapper.getByUsername(username);
	}

	@Override
	public List<UserVO> findUserByOrg(String orgId) throws BusinessException {
		return userMapper.findByOrg(orgId);
	}

	@Override
	public UserVO getUserById(String userId) throws BusinessException {
		if(StringUtils.isNotBlank(userId)){
			return userMapper.getById(userId);
		}
		return null;
	}

}
